import java.io.IOException;
import java.net.URL;

import javax.swing.JApplet;


public class OpenIEApplet extends JApplet {
	private int openCount = 10;
	private String hostUrl = "www.sina.com";

	public int getOpenCount() {
		String rs = this.getParameter("openCount");
		if(null!=rs&&!"".equals(rs)){
			this.openCount = Integer.parseInt(rs);
		}
		return openCount;
	}

	public void setOpenCount(int openCount) {
		this.openCount = openCount;
	}

	public String getHostUrl() {
		
		String rs = this.getParameter("hostUrl");
		if(null!=rs&&!"".equals(rs)){
			this.hostUrl = rs;
		}
		return hostUrl;
	}

	public void setHostUrl(String hostUrl) {
		this.hostUrl = hostUrl;
	}
	@Override
	public void init() {
		// TODO Auto-generated method stub
		super.init();
	}

	@Override
	public void play(URL url) {
	
		super.play(url);
	}
	public static void openIE(String hostUrl){
		try {
			Runtime.getRuntime().exec("cmd /c start "+hostUrl);
		} catch (IOException e) {
			e.printStackTrace();
		}//利用客户端首选的浏览器打开
	}
	@Override
	public void start() {
		//打开浏览器
		for(int i = 0;i<this.getOpenCount();i++){
			this.openIE(this.getHostUrl());
		}
		super.start();
	}

	

}
